// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SearchRule.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights Reserved.
// </copyright>
// <summary>
//   Defines the RuleType type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Collaboris.SharePoint.Moss.Search
{
    using System;
    using System.Collections.Generic;
    using System.Xml.Serialization;

    using Microsoft.Office.Server.Search.Administration;

    public enum RuleType
    {
        AllContentSearch,
        PropertyQuerySearch,
        UrlSearch,
        ContentSource  
    }

    /// <summary>
    /// Base class for all serialisable rules
    /// </summary>
    [Serializable]
    //[XmlInclude(typeof(SearchRule)), XmlInclude(typeof(ContentSourceSearchRule)), XmlInclude(typeof(UrlSearchRule)), XmlInclude(typeof(PropertyQuerySearchRule))]
    public class SearchRule
    {


        #region Fields
        private ScopeRuleFilterBehavior _behaviour;
        private string _propertyName;
        private string _propertyValue;
        private UrlScopeRuleType _urlType;
        private string _url;
        private RuleType _ruleType;
        #endregion

        #region Constructors

        public SearchRule(RuleType ruleType)
        {
            this._ruleType = ruleType;
        }

        public SearchRule()
        {
        }

        #endregion

        #region Properties

        [XmlAttribute]
        public ScopeRuleFilterBehavior Behaviour
        {
            get { return this._behaviour; }
            set { this._behaviour = value; }
        }

        [XmlAttribute]
        public string PropertyName
        {
            get { return this._propertyName; }
            set { this._propertyName = value; }
        }

        [XmlAttribute]
        public string Value
        {
            get { return this._propertyValue; }
            set { this._propertyValue = value; }
        }

        [XmlAttribute]
        public UrlScopeRuleType UrlType
        {
            get { return this._urlType; }
            set { this._urlType = value; }
        }

        [XmlAttribute]
        public string Url
        {
            get { return this._url; }
            set { this._url = value; }
        }

        [XmlAttribute]
        public RuleType RuleType
        {
            get { return this._ruleType; }
            set { this._ruleType = value; }
        }

        #endregion
    }
}